package com.netqin.netconnection;

import java.net.Proxy;

import android.os.Handler;

import com.netqin.cache.DataCache;

/**
 * 网络连接接口
 *  目前支持 request command: Get
 * @author MingLi
 * @since 2011-11-10
 */
interface Connection {
    
    /**
     * Add the request URL to fetch. The protocol must be HTTP or HTTPS.
     * @param url URL to connect to
     * @return this Connection, for chaining
     */
    public Connection addUrl(String url);
    
    /**
     * Execute the request as a GET
     * @return 本地缓存路径
     * @throws 
     */
    public String get(DataCache dataCache);   
    
    public Connection setHeader();
    
    /**
     * Configures the connection to (not) follow server redirects. By default this is <b>true</b>.
     * @param followRedirects true if server redirects should be followed.
     * @return this Connection, for chaining
     */
    public Connection followRedirects(boolean followRedirects); 
    
    public Connection setProxy(Proxy p);
    
    public void setHandler(Handler h);
    
    /**
     * 是否发送进度消息
     * @param enable
     */
    public void progress(boolean enable);
}
